﻿<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
    xmlns:mr2="http://www.wales.nhs.uk/namespaces/MessageRelease2"
    xmlns:dt="urn:schemas-microsoft-com:datatypes">
  <xsl:output version="4.0" method="html" indent="no"  omit-xml-declaration="yes" encoding="UTF-8" doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN" doctype-system="http://www.w3.org/TR/html4/loose.dtd"/>

  <xsl:include href="../rendering/DISCHARGEADVICELETTER/discharge-advice-letter_HTML.xsl"/>
  
  <xsl:template match="//GetDocumentResponse/mr2:Document">
     <div id="document" class="clinicaldocument view clearfix">
       <xsl:variable name="documentsetid" select="mr2:DocumentSupersessionSetId"/>
       <xsl:variable name="documentid" select="mr2:DocumentVersion/mr2:Header/mr2:DocumentId"/>
       <xsl:variable name="documentypecode" select="DocumentTypeCode"/>
       <xsl:variable name="sensitive" select="mr2:DocumentVersion/mr2:Header/mr2:SensitivityTypeCode"/>
       <input type="hidden" value='{$sensitive}' id='sensitive' />
       <input type="hidden" value='{$documentsetid}' id='documentsetid' />
       <div class="hidden">
         <div id="metadatamodal" class="modal">
           <h1>
             <xsl:value-of select="mr2:DocumentTitle"/>
           </h1>
           <table>
             <tr>
               <td>
                 DocumentID:
               </td>
               <td>
                 <xsl:value-of select="mr2:DocumentVersion/mr2:Header/mr2:DocumentId"/>
               </td>
             </tr>
             <tr>
               <td>
                 Document Type:
               </td>
               <td>
                 <xsl:value-of select="DocumentTypeName"/> (<xsl:value-of select="mr2:DocumentVersion/mr2:Header/mr2:DocumentAttribute[mr2:Attribute='DocumentTypeCode']/mr2:Value"/>)
               </td>
             </tr>
             <tr>
               <td>
                 Author:
               </td>
               <td>
                 <xsl:value-of select="mr2:DocumentVersion/mr2:Header/mr2:DocumentAttribute[mr2:Attribute='Author']/mr2:Value"/>
               </td>
             </tr>
             <tr>
               <td>
                 Creation Date:
               </td>
               <td>
                 <xsl:value-of select="msxsl:format-date(mr2:DocumentVersion/mr2:Header/mr2:DocumentDateTime, 'MMM dd, yyyy')"/> (<xsl:value-of select="msxsl:format-time(mr2:DocumentVersion/mr2:Header/mr2:DocumentDateTime, 'hh:mm')"/>)
               </td>
             </tr>
             <tr>
               <td>
                 Position:
               </td>
               <td>
                 <xsl:value-of select="mr2:DocumentVersion/mr2:Header/mr2:SetSequenceNumber"/>
               </td>
             </tr>
             <tr>
               <td>
                 CategoryID:
               </td>
               <td>
                 <xsl:value-of select="CategoryID"/>
               </td>
             </tr>
             <tr>
               <td>
                 Sensitive:
               </td>
               <td>
                 <xsl:value-of select="$sensitive"/>
               </td>
             </tr>
           </table>
           <button id="btnCloseMetaDataModal">Close</button>
         </div>
       </div>
       <div id="documentbody">
         <xsl:apply-templates select="mr2:DocumentVersion/mr2:Body/DocumentXML" />
       </div>
     </div>
   </xsl:template>
  
</xsl:stylesheet>
